package com.it.controller;

import com.it.common.FrameResp;
import com.it.model.LoginUserDTO;
import com.it.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @desc:
 * @author: panxiyi
 * @date: 2023/7/19 7:53 下午
 */
@RestController
@RequestMapping("user")
public class LoginController {

    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public FrameResp login(@Valid @RequestBody LoginUserDTO user) {

        String token = userService.login(user);
        return FrameResp.RET_SUCCESS(token);
    }

}
